<html xmlns:th="http://www.thymeleaf.org" xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout"
      layout:decorator="base/layout.html">


<!-- start: Content -->
<div layout:fragment="content" class="main ">
    <div class="row">
        <div class="col-lg-12">
            <ol class="breadcrumb">
                <li><i class="fa fa-home"></i><a href="index.html">主页</a></li>
                <li><i class="fa fa-list-alt"></i><a href="#">学生管理</a></li>
                <li><i class="fa fa-indent"></i>修改学生信息</li>
            </ol>
        </div>
    </div>
    <div class="row">
        <div class="col-lg-12">
            <div class="panel panel-default">
                <div class="panel-heading">
                    <h2><i class="fa fa-indent red"></i><strong>修改学生信息</strong></h2>
                </div>
                <div class="panel-body">
                    <form id="modularForm" action="" method="post" enctype="multipart/form-data"
                          class="form-horizontal ">
                        <input type="hidden" name="id" th:value="${student.id}"/>
                        <div class="form-group">
                            <label class="col-md-3 control-label" for="text-input">姓名</label>
                            <div class="col-md-9">
                                <input type="text" name="name" class="form-control" th:value="${student.name}">
                                <span class="help-block">请输入姓名</span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-md-3 control-label" for="text-input">年龄</label>
                            <div class="col-md-9">
                                <input type="text" name="age" class="form-control" th:value="${student.age}">
                                <span class="help-block">请输入年龄</span>
                            </div>
                        </div>
                        <br>
                    </form>
                </div>
                <div class="panel-footer">
                    <button id="submitBtn" type="button" class="btn btn-sm btn-success"><i
                            class="fa fa-dot-circle-o"></i> 保存
                    </button>
                    <button type="button" class="btn btn-sm btn-success" onclick="history.back()"><i
                            class="fa fa-dot-circle-o"></i> 返回
                    </button>
                </div>
                </form>
            </div>
        </div>
    </div><!--/.row-->
    <script>
        $("#submitBtn").click(function () {
            $.ajax({
                url: 'update',
                type: 'post',
                data: $('#modularForm').serialize(),
                success: function (data) {
                    layer.msg("修改成功");
                    setTimeout(function () {
                        window.location = ("student")
                    }, 1500);
                }
            })
        })
    </script>
</div>
<!-- end: Content -->

